<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <form action="/api/upload" method="post" enctype="multipart/form-data">
    <div>
      用户名：
      <input type="text" name="uid">
    </div>
    <div>
      头像：
      <button type="button" name="selectPic">请选择。。。</button>
      <input type="file" name="pic" multiple style="display: none;">
    </div>
    <div>
      照片：
      <input type="file" name="img">
    </div>
    <button type="submit">提交</button>
  </form>

  <script>
    const form = document.forms[0]

    form.selectPic.onclick = function () {
      form.pic.click()
    }

    form.pic.onchange = function () {
      form.selectPic.innerHTML = this.value
    }


  </script>
</body>

</html>